package com.yxh.www.author.api;

import com.yxh.www.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>
 *  授权中心 - 系统角色资源关系控制API集
 * </p>
 *
 * @author yangxiaohui
 * @since 2020/5/12
 */
@FeignClient(value = "author-server", contextId = "authorSmRoleResourceRelation")
public interface AuthorSmRoleResourceRelationApi {
    /**
     * 新增角色资源关系
     *
     * @param roleId      角色ID
     * @param resourceIds 资源ID集合
     * @return 统一响应 {@link Result}
     */
    @PostMapping("/smRoleResourceRelation/addSmRoleResourceRelation")
    Result<Object> addSmRoleResourceRelation(@RequestParam String roleId,
                                             @RequestParam String[] resourceIds);

    /**
     * 根据角色资源关系ID删除关系
     *
     * @param ids 关系ID集合
     * @return 统一响应 {@link Result}
     */
    @DeleteMapping("/smRoleResourceRelation/removeSmRoleResourceRelation")
    Result<Object> removeSmRoleResourceRelation(@RequestParam String[] ids);

    /**
     * 根据角色ID删除关系
     *
     * @param roleId 角色ID
     * @return 统一响应 {@link Result}
     */
    @DeleteMapping("/smRoleResourceRelation/removeSmRoleResourceRelationByRoleId")
    Result<Object> removeSmRoleResourceRelationByRoleId(@RequestParam String roleId);

    /**
     * 根据资源ID删除关系
     *
     * @param resourceId 资源ID
     * @return 统一响应 {@link Result}
     */
    @DeleteMapping("/smRoleResourceRelation/removeSmRoleResourceRelationByResourceId")
    Result<Object> removeSmRoleResourceRelationByResourceId(@RequestParam String resourceId);

    /**
     * 根据角色ID资源ID删除关系
     *
     * @param roleId     角色ID
     * @param resourceId 资源ID
     * @return 统一响应 {@link Result}
     */
    @DeleteMapping("/smRoleResourceRelation/removeSmRoleResourceRelationByRoleIdAndResourceId")
    Result<Object> removeSmRoleResourceRelationByRoleIdAndResourceId(@RequestParam String roleId,
                                                                     @RequestParam String resourceId);
}
